#!/bin/sh
#
# @name UVify Draco
#
# @type Quadrotor x
# @class Copter
#
# @output MAIN1 motor 1
# @output MAIN2 motor 2
# @output MAIN3 motor 3
# @output MAIN4 motor 4
#
# @maintainer Hyon Lim <lim@uvify.com>
#
# @board px4_fmu-v2 exclude
# @board px4_fmu-v3 exclude
# @board px4_fmu-v4pro exclude
# @board px4_fmu-v5 exclude
# @board px4_fmu-v5x exclude
# @board intel_aerofc-v1 exclude
# @board bitcraze_crazyflie exclude
#

. ${R}etc/init.d/rc.mc_defaults

set MIXER quad_x
set PWM_OUT 1234

if [ $AUTOCNF = yes ]
then
	# use the Q attitude estimator, it works w/o mag or GPS.
	param set SYS_MC_EST_GROUP 3
	param set ATT_ACC_COMP 0
	param set ATT_W_ACC 0.4
	param set ATT_W_GYRO_BIAS 0
	param set SYS_HAS_MAG 0

	# Attitude & rate gains
	param set MC_ROLL_P 8.0
	param set MC_ROLLRATE_P 0.11
	param set MC_ROLLRATE_I 0.3
	param set MC_ROLLRATE_D 0.0015
	param set MC_ROLLRATE_MAX 1600

	param set MC_PITCH_P 8
	param set MC_PITCHRATE_P 0.13
	param set MC_PITCHRATE_I 0.35
	param set MC_PITCHRATE_D 0.0015
	param set MC_PITCHRATE_MAX 1600

	param set MC_YAW_P 4
	param set MC_YAWRATE_P 0.21
	param set MC_YAWRATE_I 0.3
	param set MC_YAWRATE_D 0.0
	param set MC_YAW_FF 0.5
	param set MC_YAWRATE_MAX 600

	param set MC_ROLL_TC 0.19
	param set MC_PITCH_TC 0.16
	param set MC_AIRMODE 1

	param set MPC_MAN_TILT_MAX 60
	param set MPC_THR_CURVE 1
	param set MPC_THR_HOVER 0.25

	# Thrust curve (avoids the need for TPA)
	param set THR_MDL_FAC 0.3

	# System
	param set PWM_MAX 1950
	param set PWM_MIN 1180

	# enable one-shot
	param set PWM_RATE 0

	param set SENS_BOARD_ROT 2

	param set BAT_SOURCE 0
	param set CBRK_IO_SAFETY 22027
	#param set COM_ARM_EKF_AB 0.005
	#param set COM_DISARM_LAND 3

	# Filter settings
	param set IMU_GYRO_CUTOFF 90
	param set IMU_DGYRO_CUTOFF 100

	# Don't try to be intelligent on RC loss: just cut the motors
	#param set NAV_RCL_ACT 6

	# enable to use high-rate logging for better rate tracking analysis
	param set SDLOG_PROFILE 27

	# TELEM1 ttyS1
	#param set MAV_0_CONFIG 101
	#param set MAV_0_MODE 2  # onboard
	#param set MAV_0_RATE 20000
	#param set SER_TEL1_BAUD 921600

	# TELEM2 ttyS2
	#param set MAV_1_CONFIG 0
fi
